package com.registration.controller;

import com.registration.Annotation.OperateLog;
import com.registration.bean.MedicalRecordBean;
import com.registration.bean.OrderBean;
import com.registration.service.MedicalRecordService;
import com.registration.util.JsonResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/api/v1")
@CrossOrigin
public class MedicalRecordController {

    @Autowired
    MedicalRecordService medicalRecordService;

    @GetMapping("/getMedicalRecords")
    @OperateLog("获取就诊记录")
    public JsonResponse getMedicalRecords(@RequestParam Integer user_id) {
        List<MedicalRecordBean> medicalRecordBeanList=medicalRecordService.selectMedicalRecordsByUserId(user_id);
        if(medicalRecordBeanList==null){
            return JsonResponse.fail("暂无就诊记录");
        }else{
            return JsonResponse.success(medicalRecordBeanList);
        }
    }
}
